package com.dnjn.happiness.biz.controller.admin;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dnjn.happiness.biz.controller.common.CommonCommunicateTagsController;
import com.dnjn.happiness.biz.domain.CommunicateTags;
import com.dnjn.happiness.biz.domain.vo.CommunicateTagsVO;
import com.dnjn.happiness.common.core.utils.bean.BeanUtils;
import com.dnjn.happiness.common.core.utils.poi.ExcelUtil;
import com.dnjn.happiness.common.log.annotation.Log;
import com.dnjn.happiness.common.log.enums.BusinessType;
import com.dnjn.happiness.common.security.annotation.RequiresPermissions;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 沟通维度Controller
 *
 * @author happiness
 * @date 2024-04-01
 */
@Tag(name = "biz admin CommunicateTags 沟通维度", description = "沟通维度")
@RestController
@RequestMapping("/admin/CommunicateTags")
public class AdminCommunicateTagsController extends CommonCommunicateTagsController {
    /**
     * 导出沟通维度列表
     */
    @Log(title = "沟通维度", businessType = BusinessType.EXPORT)
    @RequiresPermissions("@ss.hasPermi('biz:CommunicateTags:export')")
    @PostMapping("/export")
    public void export(HttpServletResponse response, CommunicateTagsVO vo) {
        CommunicateTags communicateTags = new CommunicateTags();
        BeanUtils.copyPropsIgnoreNull(vo, communicateTags);

        List<CommunicateTags> list = communicateTagsService.list(Wrappers.query(communicateTags));
        ExcelUtil<CommunicateTags> util = new ExcelUtil<CommunicateTags>(CommunicateTags.class);
        util.exportExcel(response, list, "沟通维度数据");
    }
}
